<template>
  <div class="home">
    <div class="banner">
      <img class="logo" src="../assets/logo.png">
      <p class="title">NAS Runner for NAS Token</p>
      <el-row>
        <el-button plain type="success" @click="handlePlay">开始游戏</el-button>
        <el-button plain type="warning" @click="handleJump">了解更多</el-button>
      </el-row>
    </div>
    <div class="sub-container">
      <el-row :gutter="30">
        <el-col :span="8">
          <img src="../assets/01.png">
          <p class="title-1">Get NAS Stars</p>
          <p>游戏玩家通过逃亡,并且躲避障碍和危险塌陷等,来获得分数,同时通过吃星云Runner币(简称R币),玩家可以累积对应R币作为之后兑换角色使用.</p>
        </el-col>
        <el-col :span="8">
          <img src="../assets/02.jpg">
          <p class="title-1">Change Role & Earn NAS</p>
          <p>玩家可以使用对应的星云Runner币兑换角色,使用新的角色进行游戏会有更好的体验.系统每周会对获得最高分的玩家下发0.1NAS的奖励.</p>
        </el-col>
        <el-col :span="8">
          <img src="../assets/03.jpg">
          <p class="title-1">Records written in BlockChain</p>
          <p>玩家可以选择将记录永久保存在区块链中,不可篡改.星云链为玩家提供了可靠的区块链环境.</p>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.banner {
  min-height: 500px;
  background-image: url(../assets/banner.jpg);
  background-repeat: no-repeat;
  background-size: cover;
  text-align: center;
  color: #fff;
  padding: 50px 0;
  box-sizing: border-box;
  .logo {
    width: 164px;
    height: 50px;
  }
  .title {
    font-size: 40px;
    text-shadow: 5px 5px 5px #000;
  }
  .el-button {
    padding: 16px 50px;
    margin: 0 20px;
  }
}
.sub-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 50px 0;
  img {
    width: 60%;
  }
  .title-1 {
    font-size: 20px;
    font-weight: 400;
  }
}
</style>

<script>
// @ is an alias to /src

export default {
  name: 'home',
  methods: {
    handleJump () {
      this.$store.commit('handleresetMenu')
      this.$router.push('/guide')
    },
    handlePlay () {
      let mb = this.myBrowser()
      if (mb !== 'Chrome') {
        this.$message.error('请使用Chrome浏览器')
      } else if (typeof webExtensionWallet === 'undefined') {
        this.$message.error('请安装星云插件')
      } else {
        window.location.href = 'http://125.216.243.86'
      }
    },
    myBrowser () {
      let userAgent = navigator.userAgent // 取得浏览器的userAgent字符串
      if (userAgent.indexOf('Opera') > -1) {
        return 'Opera'
      }; // 判断是否Opera浏览器
      if (userAgent.indexOf('Firefox') > -1) {
        return 'FF'
      } // 判断是否Firefox浏览器
      if (userAgent.indexOf('Chrome') > -1) {
        return 'Chrome'
      }
      if (userAgent.indexOf('Safari') > -1) {
        return 'Safari'
      } // 判断是否Safari浏览器
      if (userAgent.indexOf('compatible') > -1 && userAgent.indexOf('MSIE') > -1) {
        return 'IE'
      }; // 判断是否IE浏览器
    }
  }
}
</script>
